class CreateArtworks < ActiveRecord::Migration
  def self.up
    create_table :artworks do |t|
      t.string :name
      t.float :price
      t.float :height
      t.float :width
      t.float :depth
      t.float :weight
      t.integer :time_to_make
      t.boolean :published
      t.references :artist

      t.timestamps
    end
    
    Artwork.create :name => "Tapestry", :price => "1234.03", :artist => Artist.find_by_name('Joe Testuser'), :published => true
    Artwork.create :name=> "Yarn painting", :price => "1123.98", :artist => Artist.find_by_name('Joe Testuser'), :published => true
    Artwork.create :name=> "Test1", :price => "123.98", :artist => Artist.find_by_name('Joe Testuser'), :published => true
    Artwork.create :name=> "Test2", :price => "1123.98", :artist => Artist.find_by_name('Joe Testuser'), :published => true
    Artwork.create :name=> "Test3", :price => "6.98", :artist => Artist.find_by_name('Joe Testuser'), :published => true
    Artwork.create :name=> "Test4", :price => "17.98", :artist => Artist.find_by_name('Joe Testuser'), :published => true
    Artwork.create :name=> "Test5", :price => "17.98", :artist => Artist.find_by_name('Joe Testuser'), :published => true
    
    Artwork.create :name => 'Moccasins 1', :price => '80.00', :artist => Artist.find_by_name('Rose'), :published => true
  end

  def self.down
    drop_table :artworks
  end
end
